<fieldset>

    <legend>条件搜索</legend>

    <form class="layui-form layui-form-pane form-search" id="singcms-form" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">访客姓名</label>
            <div class="layui-input-inline">
                <input name="nickname" value="{$Think.get.nickname|default=''}" placeholder="请输入访客姓名" class="layui-input">
            </div>
        </div>
		
		<div class="layui-form-item layui-inline">
		    <label class="layui-form-label">拜访部门</label>
		    <div class="layui-input-inline">
		        <input name="department" value="{$Think.get.department|default=''}" placeholder="请输入拜访部门名字" class="layui-input">
		    </div>
		</div>
		
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">拜访目的</label>
            <div class="layui-input-inline">
                <input name="visit_target" value="{$Think.get.visit_target|default=''}"  placeholder="请输入拜访目的" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">到访情况</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="status">
                    {foreach [''=>'-- 全部状态 --','0'=>'未到访访客','1'=>'已到访访客'] as $k=>$v}
                    {eq name='Think.get.status' value='$k.""'}
                    <option selected value="{$k}">{$v}</option>
                    {else}
                    <option value="{$k}">{$v}</option>
                    {/eq}
                    {/foreach}
                </select>
            </div>
        </div>
		
		
       <div class="layui-form-item layui-inline">
           <label class="layui-form-label">添加时间</label>
           <div class="layui-input-inline">
       		  <input type="text" class="layui-input" id="create_at_first" name="create_at_first" value="{$Think.get.create_at_first|default=''}"  placeholder="请选择添加时间">			 
        <!--  <input data-date-range name="create_at" id="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择添加时间" class="layui-input"> -->
           </div>
         <div class="layui-form-mid">—</div>
       	   <div class="layui-input-inline">
       	<input type="text" class="layui-input" id="create_at_last" name="create_at_last" value="{$Think.get.create_at_last|default=''}"  placeholder="请选择添加时间">
       	</div>
       </div>
		  
			  <div class="layui-form-item layui-inline">
			    <button class="layui-btn layui-btn-primary" id="singcms-button-submit"><i class="layui-icon">&#xe615;</i> 搜 索</button>
			</div>
    </form>

</fieldset>

<script>form.render()</script>
<script>
	$("#singcms-button-submit").click(function() {
	    var data = $("#singcms-form").serializeArray();
	    postData = {};
	    $(data).each(function(i) {
	        postData[this.name]= this.value;
	    });
		// postData['create_at']=create_at;
	    console.log(postData);
		
	    // 将获取到的数据post给服务器
	    url = SCOPE.save_url;
	    jump_url = SCOPE.jump_url;
	    $.post(url, postData, function(result) {
	        if (result.code == 200) {
	            //成功
	            return dialog.success(result.message, jump_url);
	        } else if (result.code == 400) {
	            // 失败
	            return dialog.error(result.message);
	        }
	    }, "JSON");
	});
	


</script>
<script>
		var SCOPE = {
		'save_url' : "{:url('appointment/appointment/index')}",
		'jump_url' : "{:url('appointment/appointment/index')}",
	
	};
</script>
